package cn.iocoder.yudao.module.cmt.dal.mysql.base;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.cmt.dal.dataobject.base.BaseCommunityDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.cmt.controller.admin.base.vo.*;

/**
 * 社区信息 Mapper
 *
 * @author LRC
 */
@Mapper
public interface BaseCommunityMapper extends BaseMapperX<BaseCommunityDO> {

    default PageResult<BaseCommunityDO> selectPage(BaseCommunityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BaseCommunityDO>()
                .eqIfPresent(BaseCommunityDO::getCode, reqVO.getCode())
                .likeIfPresent(BaseCommunityDO::getName, reqVO.getName())
                .eqIfPresent(BaseCommunityDO::getProvince, reqVO.getProvince())
                .eqIfPresent(BaseCommunityDO::getCity, reqVO.getCity())
                .eqIfPresent(BaseCommunityDO::getDistrict, reqVO.getDistrict())
                .eqIfPresent(BaseCommunityDO::getStreet, reqVO.getStreet())
                .eqIfPresent(BaseCommunityDO::getAddress, reqVO.getAddress())
                .likeIfPresent(BaseCommunityDO::getContactPerson, reqVO.getContactPerson())
                .likeIfPresent(BaseCommunityDO::getContactPhone, reqVO.getContactPhone())
                .eqIfPresent(BaseCommunityDO::getLogo, reqVO.getLogo())
                .eqIfPresent(BaseCommunityDO::getIntroduction, reqVO.getIntroduction())
                .eqIfPresent(BaseCommunityDO::getSort, reqVO.getSort())
                .eqIfPresent(BaseCommunityDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BaseCommunityDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(BaseCommunityDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BaseCommunityDO::getId));
    }

}